{extend name="common/base" /}
{block name="main"}
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 15px;">
    <legend>修改用户</legend>
</fieldset>
<form class="layui-form" action="{:url('update')}" method="post">
    <input type="hidden" name="uuid" value="{$info.user_uuid}"/>
    <input type="hidden" name="id" value="{$info.id}"/>
    <div class="layui-form-item">
        <label class="layui-form-label">用户名称</label>
        <div class="layui-input-inline">
            <input type="text" name="user_name" id="user_name" value="{$info.user_name}" autocomplete="off" class="layui-input" placeholder="请输入用户名称">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{load href="/static/js/jquery-1.10.2.min.js"/}
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
        //监听提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                url:"{:url('update')}",
                data:data.field,
                type:"POST",
                success:function (data) {
                    if (data.code==0) {
                        layer.open({
                            title:"提示信息",
                            btn:["确认"],
                            content:"修改成功",
                            yes:function(){
                                //点击确认后进入的函数
                                window.location.href="{:url('index')}";
                            }
                        });
                    } else {
                        layer.alert(data.msg,{icon:2});
                    }
                }
            });

            return false;
        });


    });
</script>

{/block}
